<?php
// +----------------------------------------------------------------------
// | 用户私信聊天记录
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 微尘 <yicmf@qq.com>
// +----------------------------------------------------------------------
namespace app\model\pos;

use app\model\file\Image;
use app\model\ucenter\User;
use think\model\concern\SoftDelete;

class PosOrderVip extends Common
{
    use SoftDelete;

//    public function user()
//    {
//        return $this->belongsTo(User::class,'user_id')->field('id,nickname,avatar');
//    }

    public function cover()
    {
        return $this->belongsTo(Image::class,'cover_id')->field('id,save_name,url,save_path,driver');
    }

    public function getBodyAttr($value)
    {

        return str_replace('src="/ueditor/php/upload','src="'.self::$request->domain().'/ueditor/php/upload',$value);
    }

    /**
     * 写入修改
     * @param $data
     */
    public static function onBeforeInsert($data)
    {
        $data['ip'] = !empty($data['ip']) ? $data['ip'] : self::$request->ip();
        $data['status'] = 1;
    }

    protected $type = [
    ];
}
